package com.imti.mall.sale.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.imti.mall.model.sms.pojo.SmsFlashPromotion;
import com.imti.mall.sale.dao.SmsFlashPromotionDao;
import com.imti.mall.sale.service.SmsFlashPromotionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.List;

/**
 * ClassName: SmsFlashPromotionServiceImpl
 * Description:
 * date: 2022/9/20 0:18
 *
 * @author: youhun
 * @version:
 * @since JDK 1.8
 */
@Service
public class SmsFlashPromotionServiceImpl extends ServiceImpl <SmsFlashPromotionDao, SmsFlashPromotion> implements SmsFlashPromotionService {
    @Autowired
    SmsFlashPromotionDao smsFlashPromotionDao;
    /**
     * 查询限时购表
     * @param smsFlashPromotion
     * @return
     */
    @Override
    public List<SmsFlashPromotion> findSmsFlashPromotion(SmsFlashPromotion smsFlashPromotion,Integer pageSize,Integer pageNum) {
        PageHelper.startPage(pageNum, pageSize);
        return smsFlashPromotionDao.findSmsFlashPromotion(smsFlashPromotion);
    }
    /**
     * 查询限时购表总条数
     * @param smsFlashPromotion
     * @return
     */
    @Override
    public Integer countSmsFlashPromotion(SmsFlashPromotion smsFlashPromotion) {
        return smsFlashPromotionDao.countSmsFlashPromotion(smsFlashPromotion);
    }
    /**
     * 根据id修改限时购
     * @param smsFlashPromotion
     * @return
     */
    @Override
    public Integer updateSmsFlashPromotion(SmsFlashPromotion smsFlashPromotion) {
        return smsFlashPromotionDao.updateSmsFlashPromotion(smsFlashPromotion);
    }

    @Override
    public boolean addSmsFlashPromotion(SmsFlashPromotion smsFlashPromotion) {
        return save(smsFlashPromotion);
    }

    @Override
    public boolean deleteSmsFlashPromotion(SmsFlashPromotion smsFlashPromotion) {
        return removeById(smsFlashPromotion);
    }


}
